package com.ma.old;

public class Reverse {


    public static void main(String[] args) {
        System.getProperties().list(System.out);

    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        int[] newArr = new int[n];
        for (int i = 0; i < n; ++i) {
            newArr[(i + k) % n] = nums[i];
        }
        System.arraycopy(newArr, 0, nums, 0, n);
    }

    public static int[] reverse(int[] nums1, int start, int end) {
        int temp;
        while (start < end) {
            temp = nums1[start];
            nums1[start] = nums1[end];
            nums1[end] = temp;
            start++;
            end--;
        }
        return nums1;
    }
}
